import React from 'react'
import { withRouter, Switch, Redirect } from 'react-router-dom'
import LoadableComponent from '../../utils/LoadableComponent'
import PrivateRoute from '../PrivateRoute'

const Home = LoadableComponent(()=>import('../../routes/Home'))
// const Index = LoadableComponent(()=>import('../../routes/Home'))

const Role = LoadableComponent(()=>import('../../routes/Role'))
const Permission = LoadableComponent(()=>import('../../routes/Permission'))
const SystemUser = LoadableComponent(()=>import('../../routes/SystemUser'))
const MainRudder = LoadableComponent(()=>import('../../routes/MainRudder'))
const Rudder = LoadableComponent(()=>import('../../routes/Rudder'))
const RudderTitle = LoadableComponent(()=>import('../../routes/RudderTitle'))
const RudderApp = LoadableComponent(()=>import('../../routes/RudderApp'))
const User = LoadableComponent(()=>import('../../routes/User'))
const Hall = LoadableComponent(()=>import('../../routes/Hall'))
const HallPay = LoadableComponent(()=>import('../../routes/HallPay'))

const InsideUser = LoadableComponent(()=>import('../../routes/InsideUser'))
const Product = LoadableComponent(()=>import('../../routes/Product'))

const HallApply = LoadableComponent(()=>import('../../routes/HallApply'))

const Article = LoadableComponent(()=>import('../../routes/Article/Article'))
const SalesStatistics = LoadableComponent(()=>import('../../routes/Statistics/Sales'))
const SalesStatisticsDetail = LoadableComponent(()=>import('../../routes/Statistics/Sales-detail'))

const HallRelation = LoadableComponent(()=>import('../../routes/Statistics/HallRelation'))

const ArticleStatistics = LoadableComponent(()=>import('../../routes/Statistics/Article'))
const NetworkDataStatistics = LoadableComponent(()=>import('../../routes/Statistics/Network'))
const NetworkRudderDataStatistics = LoadableComponent(()=>import('../../routes/Statistics/NetworkRudder'))

const MessageTemp = LoadableComponent(()=>import('../../routes/SystemManage/MessageTemp'))
const RedeemCode = LoadableComponent(()=>import('../../routes/RedeemCode'))

const HallUserLabel = LoadableComponent(()=>import('../../routes/HallUserLabel'))

const UserLabel = LoadableComponent(()=>import('../../routes/UserLabel'))


@withRouter
class ContentMain extends React.Component {
  render () {
    return (
      <div style={{padding: 16, position: 'relative'}}>
        <Switch>
          <PrivateRoute exact path='/index' component={Home}/>
          <PrivateRoute exact path='/roles' component={Role}/>
          <PrivateRoute exact path='/permission' component={Permission}/>
          <PrivateRoute exact path='/system-user' component={SystemUser}/>
          <PrivateRoute exact path='/main-rudder' component={MainRudder}/>
          <PrivateRoute exact path='/rudder' component={Rudder}/>
          <PrivateRoute exact path='/ruddertitle' component={RudderTitle}/>

          <PrivateRoute exact path='/rudder-app' component={RudderApp}/>
          <PrivateRoute exact path='/user' component={User}/>
          <PrivateRoute exact path='/hall' component={Hall}/>
          <PrivateRoute exact path='/hallpay' component={HallPay}/>

          
          <PrivateRoute exact path='/inside-user' component={InsideUser}/>
          <PrivateRoute exact path='/article/index' component={Article}/>
          <PrivateRoute exact path='/product' component={Product}/>
          <PrivateRoute exact path='/article' component={Article}/>
          
          <PrivateRoute exact path='/statistics/sales' component={SalesStatistics}/>
          <PrivateRoute exact path='/statistics/salesdetail' component={SalesStatisticsDetail}/>

          <PrivateRoute exact path='/statistics/hallRelation' component={HallRelation}/>

          <PrivateRoute exact path='/statistics/article' component={ArticleStatistics}/>
          <PrivateRoute exact path='/statistics/networkdata' component={NetworkDataStatistics}/>
          <PrivateRoute exact path='/statistics/networkrudderdata' component={NetworkRudderDataStatistics}/>
          <PrivateRoute exact path='/system-manage/message-temp' component={MessageTemp}/>

          <PrivateRoute exact path='/hallapply' component={HallApply}/>

          <PrivateRoute exact path='/redeemcode' component={RedeemCode}/>

          <PrivateRoute exact path='/halluserlabel' component={HallUserLabel}/>
          <PrivateRoute exact path='/userlabel' component={UserLabel}/>

          
          <Redirect exact from='/' to='/index'/>

        </Switch>
      </div>
    )
  }
}

export default ContentMain
